public class Game {
    public CheckerBoard checkerboard = new CheckerBoard();//1代表X，-1代表O
    private int turn = 1;//表达当前轮次，1为X走，-1为O走

    //游戏主方法playGame
    //输入为对弈双方轮番落子的位置，以英文逗号为间隔，X先走
    public Result playGame(String s){
        String[] position = s.split(",");

        for (String pos:position){
            checkerboard.setBoard(turn,pos);
            checkerboard.print();
            if (checkerboard.getStatement() != Result.DRAW) break;
            turn *= -1;
        }
        return checkerboard.getStatement();
    }
    
    public static void main(String[] args){
        Game game = new Game();
        Result result = game.playGame("B2,C2,C1,A3,B3,B1,A2,B2,C3,A1,A3,B3,C2,B1,B2,A2,A1,C1,C3");
        System.out.println(result);
    }
}
